<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>添加收货地址</title>
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, width=device-width">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-touch-fullscreen" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no">
		<meta name="format-detection" content="address=no">
		<link rel="stylesheet" type="text/css" href="css/common.css">
		<link rel="stylesheet" type="text/css" href="css/index.css">
		<link rel="stylesheet" type="text/css" href="css/mui.min.css"/>
		<link rel="stylesheet" href="css/reset.css">
		<script src="js/jquery-1.8.2.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="js/iscroll.js"></script>
		<script type="text/javascript" src="js/jquery.flexslider-min.js"></script>
		<script src="js/hmt.js" type="text/javascript"></script>
		<script type="text/javascript" src="js/index.js"></script>
		<script src="js/swiper.min.js" type="text/javascript" ></script>
	</head>
	<body>
		<header class="hasManyCity hasManyCitytwo" id="header">
			<a href="javascript:history.go(-1)" class="fl fanhui"><i class="iconfont icon-fanhui"></i></a>
			<div class="header-tit">
				添加收货地址
			</div>
			<a href="#" id="save_address" class="fr baocun">保存</a>
		</header>
		<div id="container">
		    <div id="main" class="mui-clearfix add-address">
		    	<div class="plist clearfloat data">
					<ul>
						<li class="clearfloat">
							<a href="#">
								<p class="fl">收货人</p>
								<input type="text" class="fr shuru" name="" id="name" value="" placeholder="请输入昵称" />
							</a>
						</li>
						<li class="clearfloat">
							<a href="#">
								<p class="fl">联系电话</p>
								<input type="text" class="fr shuru" name="" id="phone" value="" placeholder="请输入手机号码" />
							</a>
						</li>
						<li class="clearfloat">
							<a href="#">
								<p class="fl">所在省份</p>
								<!--  <select name="" id="address-add">
									

									<option value="${region_id}">${region_name}</option>

									
								</select>  -->
								<i class="fr iconfont icon-jiantou1"></i>
							</a>
						</li>
						<li class="clearfloat">
							<a href="#">
								<p class="fl">所在城市</p>
								<i class="fr iconfont icon-jiantou1"></i>
							</a>
						</li>
						<li class="clearfloat">
							<a href="#">
								<p class="fl">所在区县</p>
								<i class="fr iconfont icon-jiantou1"></i>
							</a>
						</li>
						<li class="clearfloat">
							<a href="#">
								<p class="fl">街道</p>
								<i class="fr iconfont icon-jiantou1"></i>
							</a>
						</li>
					</ul>
				</div>
				<textarea name="" id="xiangqing" rows="4" cols="" placeholder="请填写详细地址，不少于5个字" class="textare box-s"></textarea>
		    	<div class="address-btn clearfloat">
		    		<span class="szwmr fl">设为默认</span>
		    		<a href="#" class="toggle toggle--on fr"></a>
		    	</div>
		    </div>
		</div>
	</body>
	<!--默认按钮-->
	<script type="text/javascript">
	function city_address_callback(res){
		$("#order_product").tmpl(res.data).appendTo('#address-add');
	}
	
	
 function add_address_callback(res){
	if(res){
		alert(res.msg);
	}else{
		alert(res.msg);
	}
}
$("#save_address").click(function(){
	add_address_callback();
})
	$('.toggle').click(function(e){
	
		var toggle = this;
		
		e.preventDefault();
	
		$(toggle).toggleClass('toggle--on').toggleClass('toggle--off').addClass('toggle--moving');
	
		setTimeout(function(){
			
			$(toggle).removeClass('toggle--moving');
			
		}, 200)
		
	});
	
	$(function(){
		//省市县三级调用
		var city_address_name = "region_get";
		var region_id = '1';
		
		//添加收货地址
		var function_name = "address_save";
		
		var loginItem = get_login_info();//获取登录信息 
		
		var userid = loginItem.userid;
		
		var checkstr = loginItem.checkstr;
		
		var name = $("#name").val();
		
		var phone = $("#phone").val();
		
		var city = $("xiangqing").val();
		
		var request_data = {'userid':userid, 'checkstr':checkstr,'name':name,'phone':phone,'city':city};
			
		ajax_request_server(function_name, request_data, add_address_callback)
		
		ajax_request_server(city_address_name, region_id, city_address_callback)
	})
	</script>
</html>
